<?php
require('./roots.php');
require($root_path.'include/inc_environment_global.php');
global $db;
extract($_POST);

$sql = "SELECT pid FROM care_person WHERE nat_id_nr='" . $val . "'";

if($result=$db->Execute($sql)){
    if ($result->RecordCount())
    {
        $acum = "alert('Ya existe un paciente con cédula $val registrado en el sistema.'); document.getElementById('nat_id_nr').focus();";
    }
}

print_r($acum);
?>